﻿@inject IOptionsMonitor<WebsiteOptions> WebsiteOption

<Nav Items="@Items" IsPills="true" IsFill="true">
    <a class="nav-link nav-item active" href="#" @onclick:preventDefault>Active</a>
    <NavLink class="nav-link nav-item" href="#" @onclick:preventDefault>Link</NavLink>
    <a class="nav-link nav-item" href="#" @onclick:preventDefault>Link</a>
    <a class="nav-link nav-item disabled" href="#" tabindex="-1" aria-disabled="true" @onclick:preventDefault>Disabled</a>
</Nav>

@code {
        private IEnumerable<NavLink> Items => GetItems();

    private IEnumerable<NavLink> GetItems()
    {
        var ret = new List<NavLink>();
        var link = new NavLink();
        var parameters = new Dictionary<string, object?>()
        {
            ["href"] = WebsiteOption.CurrentValue.AdminUrl,
            ["class"] = "nav-link nav-item",
            ["target"] = "_blank",
            ["ChildContent"] = new RenderFragment(builder =>
            {
                builder.AddContent(0, "BootstrapAdmin");
            })
        };
        link.SetParametersAsync(ParameterView.FromDictionary(parameters));
        ret.Add(link);
        return ret;
    }
}
